//导入所需的react和react-dom
import {Fragment} from 'react'
import ReactDOM from 'react-dom/client'
import './index.css'
//定义name变量
let name="Giles"
//定义age变量
let age=38
//身份证号
let idcard="610122198404084055"
//定义一个获取生日的函数
const getBirthday=idcard=>idcard.slice(6,10)+"-"+idcard.slice(10,12)+"-"+idcard.slice(12,14)
//定义图像
let avatar="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fwww.woniuxy.cn%2Fimg%2Fteacher%2Fzhaijizhe.png&refer=http%3A%2F%2Fwww.woniuxy.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1665819315&t=33f00de2fb8b66ab996b1e579175ed85"
const template=(<Fragment>
  <div>姓名:{name}</div>
  <div>年龄:{age}</div>
  <div>
    <img src={avatar} className="avatar"/>
  </div>
  <div>是否成年：{age>=18?'成年':'未成年'}</div>  
  <div>生日：{getBirthday(idcard)}</div>


</Fragment>)

const root=ReactDOM.createRoot(document.getElementById('root'))
root.render(template)